module.exports = (app, School) ->
  app.get '/signup/individual', (req, res) ->
    res.render 'signup/individual'
  app.get '/signup/school', (req, res) ->
    res.render 'signup/school'
  # School signup utilities
  app.post '/school/id/check', (req, res) ->
    School.find { si: req.body.i }, (err, docs) ->
      if docs.length > 0
        res.json { error: yes }
      else
        res.json { error: no }
  app.post '/signup/school/validate', (req, res) ->
    school = new School {
      si: req.body.i
      sn: req.body.u
      em: req.body.e
      pw: req.body.p
    }
    if school.errors
      res.json { error: yes }
    else
      school.save()
      res.json { error: no }
